﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
    <link type="text/css" rel="stylesheet" media="all" href="../../styles/global.css"/>
    <link type="text/css" rel="stylesheet" media="all" href="../../styles/global_color.css"/>
</head>
<body>
<!--Logo区域开始-->
<div id="header">
    <img src="../../images/logo.png" alt="logo" class="left"/>
    <a href="/logout">[退出]</a>
</div>
<!--Logo区域结束-->
<!--导航区域开始-->
<div id="navi">
    <ul id="menu">
        <li><a href="/index" class="index_on"></a></li>
        <li><a href="/rolelist" class="role_off"></a></li>
        <li><a href="/adminList" class="admin_off"></a></li>
        <li><a href="/feelist" class="fee_off"></a></li>
        <li><a href="/accountlist" class="account_off"></a></li>
        <li><a href="/servicelist" class="service_off"></a></li>
        <li><a href="/billList" class="bill_off"></a></li>
        <li><a href="/reportList" class="report_off"></a></li>
        <li><a href="/userInfo" class="information_off"></a></li>
        <li><a href="/userModiPwd" class="password_off"></a></li>
    </ul>
</div>
<!--导航区域结束-->
<!--主要区域开始-->
<div id="report_main">
    <div class="tabs">
        <ul onclick="changeTab(event,this);">
            <li><a href="javascript:void(0)" class="tab_on" title="每位客户每月的累计时长" onclick="clickTab(1)">客户使用时长</a></li>
            <li><a href="javascript:void(0)" class="tab_out" title="每台服务器上累计时长最高的前三名客户" onclick="clickTab(2)">时长排行榜</a></li>
            <li><a href="javascript:void(0)" class="tab_out" title="每台服务器每种资费标准的使用次数" onclick="clickTab(3)">资费使用率</a></li>
        </ul>
    </div>
    <div class="report_box">
        <!--数据区域：用表格展示数据-->
        <div id="report_data">
            <table id="datalist">
            </table>
        </div>
        <!--分页-->
        <div id="pages">
        </div>

    </div>
</div>
<!--主要区域结束-->
<div id="footer">
    <p>[源自北美的技术，最优秀的师资，最真实的企业环境，最适用的实战项目]</p>
    <p>版权所有(C)云科技有限公司 </p>
</div>
<script src="../../js/jquery-3.2.1.js"></script>
<script src="../../js/parseDate.js"></script>
<script>
    function changeTab(e, ulObj) {
        var obj = e.srcElement || e.target;
        if (obj.nodeName == "A") {
            var links = ulObj.getElementsByTagName("a");
            for (var i = 0; i < links.length; i++) {
                if (links[i].innerHTML == obj.innerHTML) {
                    links[i].className = "tab_on";
                }
                else {
                    links[i].className = "tab_out";
                }
            }
        }
    }
    var ip = 1;
    $.ajax({
        url: "/costPage",
        type: "post",
        data: {
            pagenum: ip
        },
        success: function (data) {
            $("#datalist").append("<tr><th>账号 ID</th><th>账务帐号</th><th>客户名称</th><th class='width200'>身份证号码</th><th>电话</th><th class='width150'>月份</th><th class='width150'>累积时长</th></tr>");
            for (var i in data.list) {
                var list = data.list[i];
                for (var j in list.cList) {
                    var cList = list.cList[j];
                    var startime = cList.startime;
                    for (var k in list.aList) {
                        var aList = list.aList[k];
                        var accountId=aList.accountId;
                        var realName=aList.realName;
                        var loginName = aList.loginName;
                        var idcardNo=aList.idcardNo;
                        var telephone=aList.telephone;
                        var cD = aList.createDate;
                        var createDate = getTime(cD);
                        var lastLoginTime=aList.lastLoginTime;
                        var lastStart=lastLoginTime-startime;
                        var hours=gethTime(lastStart);
                        var minutes=getmTime(lastStart);
                    }
                }
                $("#datalist").append("<tr><td>"+accountId+"</td><td>"+loginName+"</td><td>"+realName+"</td><td>"+idcardNo+"</td><td>"+telephone+"</td><td>"+createDate+"</td><td>"+hours+"小时"+minutes+"分"+"</td></tr>");
            }
            //            当前页码
            var pageNum = data.pageNum;
//            每页的数量
            var pageSize = data.pageSize;
//            当前页的数量
            var size = data.size;
//            数据总数
            var total = data.total;
//            一共多少页
            var pages = data.pages;
//            首页是多少
            var firstPage = data.firstPage;
//            上一页是多少
            var prePage = data.prePage;
//            下一页是多少
            var nextPage = data.nextPage;
//            最后一页是多少
            var lastPage = data.lastPage;
//            是否是首页
            var isFirstPage = data.isFirstPage;
//            是否是尾页
            var isLastPage = data.isLastPage;
            if (isFirstPage) {
                prePage = prePage + 1;
            }
            if (isLastPage) {
                nextPage = lastPage;
            }
            $("#pages").append($("<a href='javascript:void(0)' onclick='page(" + prePage + ")'>" + "<<<" + "</a>"));
            for (i = 1; i <= lastPage; i++) {
                $("#pages").append($("<a href='javascript:void(0)' onclick='page(" + i + ")'>" + i + "</a>"))
            }
            $("#pages").append($("<a href='javascript:void(0)' onclick='page(" + nextPage + ")'>" + ">>>" + "</a>"));
            var urlstatus = false;
            if (!urlstatus) {
                $("#pages a").eq(1).addClass('current_page');
            }
        }
    });
    function page(i) {
        ip = i;
        $.ajax({
            url: "/costPage",
            type: "post",
            data: {
                pagenum: ip
            },
            success: function (data) {
                $("#datalist").html("");
                $("#datalist").append("<tr><th>账号 ID</th><th>账务帐号</th><th>客户名称</th><th class='width200'>身份证号码</th><th>电话</th><th class='width150'>月份</th><th class='width150'>累积时长</th></tr>");
                for (var i in data.list) {
                    var list = data.list[i];
                    for (var j in list.cList) {
                        var cList = list.cList[j];
                        var startime = cList.startime;
                        for (var k in list.aList) {
                            var aList = list.aList[k];
                            var accountId=aList.accountId;
                            var realName=aList.realName;
                            var loginName = aList.loginName;
                            var idcardNo=aList.idcardNo;
                            var telephone=aList.telephone;
                            var cD = aList.createDate;
                            var createDate = getTime(cD);
                            var lastLoginTime=aList.lastLoginTime;
                            var lastStart=lastLoginTime-startime;
                            var hours=gethTime(lastStart);
                            var minutes=getmTime(lastStart);
                        }
                    }
                    $("#datalist").append("<tr><td>"+accountId+"</td><td>"+loginName+"</td><td>"+realName+"</td><td>"+idcardNo+"</td><td>"+telephone+"</td><td>"+createDate+"</td><td>"+hours+"小时"+minutes+"分"+"</td></tr>");
                }
                //            当前页码
                var pageNum = data.pageNum;
//            每页的数量
                var pageSize = data.pageSize;
//            当前页的数量
                var size = data.size;
//            数据总数
                var total = data.total;
//            一共多少页
                var pages = data.pages;
//            首页是多少
                var firstPage = data.firstPage;
//            上一页是多少
                var prePage = data.prePage;
//            下一页是多少
                var nextPage = data.nextPage;
//            最后一页是多少
                var lastPage = data.lastPage;
//            是否是首页
                var isFirstPage = data.isFirstPage;
//            是否是尾页
                var isLastPage = data.isLastPage;
                if (isFirstPage) {
                    prePage = prePage + 1;
                }
                if (isLastPage) {
                    nextPage = lastPage;
                }
                $("#pages").html("");
                $("#pages").append($("<a href='javascript:void(0)' onclick='page(" + prePage + ")'>" + "<<<" + "</a>"));
                for (i = 1; i <= lastPage; i++) {
                    $("#pages").append($("<a href='javascript:void(0)' onclick='page(" + i + ")'>" + i + "</a>"))
                }
                $("#pages").append($("<a href='javascript:void(0)' onclick='page(" + nextPage + ")'>" + ">>>" + "</a>"));
                $("#pages a").siblings('a').removeClass('selected');
                $("#pages a").eq(pageNum).addClass('current_page');
            }
        });
    }
    function clickTab(num){
        alert(num);
        if (num==1){
            var ip = 1;
            $.ajax({
                url: "/costPage",
                type: "post",
                data: {
                    pagenum: ip
                },
                success: function (data) {
                    $("#datalist").html("");
                    $("#datalist").append("<tr><th>账号 ID</th><th>账务帐号</th><th>客户名称</th><th class='width200'>身份证号码</th><th>电话</th><th class='width150'>月份</th><th class='width150'>累积时长</th></tr>");
                    for (var i in data.list) {
                        var list = data.list[i];
                        for (var j in list.cList) {
                            var cList = list.cList[j];
                            var startime = cList.startime;
                            for (var k in list.aList) {
                                var aList = list.aList[k];
                                var accountId=aList.accountId;
                                var realName=aList.realName;
                                var loginName = aList.loginName;
                                var idcardNo=aList.idcardNo;
                                var telephone=aList.telephone;
                                var cD = aList.createDate;
                                var createDate = getTime(cD);
                                var lastLoginTime=aList.lastLoginTime;
                                var lastStart=lastLoginTime-startime;
                                var hours=gethTime(lastStart);
                                var minutes=getmTime(lastStart);
                            }
                        }
                        $("#datalist").append("<tr><td>"+accountId+"</td><td>"+loginName+"</td><td>"+realName+"</td><td>"+idcardNo+"</td><td>"+telephone+"</td><td>"+createDate+"</td><td>"+hours+"小时"+minutes+"分"+"</td></tr>");
                    }
                    //            当前页码
                    var pageNum = data.pageNum;
//            每页的数量
                    var pageSize = data.pageSize;
//            当前页的数量
                    var size = data.size;
//            数据总数
                    var total = data.total;
//            一共多少页
                    var pages = data.pages;
//            首页是多少
                    var firstPage = data.firstPage;
//            上一页是多少
                    var prePage = data.prePage;
//            下一页是多少
                    var nextPage = data.nextPage;
//            最后一页是多少
                    var lastPage = data.lastPage;
//            是否是首页
                    var isFirstPage = data.isFirstPage;
//            是否是尾页
                    var isLastPage = data.isLastPage;
                    if (isFirstPage) {
                        prePage = prePage + 1;
                    }
                    if (isLastPage) {
                        nextPage = lastPage;
                    }
                    $("#pages").html("");
                    $("#pages").append($("<a href='javascript:void(0)' onclick='page(" + prePage + ")'>" + "<<<" + "</a>"));
                    for (i = 1; i <= lastPage; i++) {
                        $("#pages").append($("<a href='javascript:void(0)' onclick='page(" + i + ")'>" + i + "</a>"))
                    }
                    $("#pages").append($("<a href='javascript:void(0)' onclick='page(" + nextPage + ")'>" + ">>>" + "</a>"));
                    var urlstatus = false;
                    if (!urlstatus) {
                        $("#pages a").eq(1).addClass('current_page');
                    }
                }
            });
            function page(i) {
                ip = i;
                $.ajax({
                    url: "/costPage",
                    type: "post",
                    data: {
                        pagenum: ip
                    },
                    success: function (data) {
                        $("#datalist").html("");
                        $("#datalist").append("<tr><th>账号 ID</th><th>账务帐号</th><th>客户名称</th><th class='width200'>身份证号码</th><th>电话</th><th class='width150'>月份</th><th class='width150'>累积时长</th></tr>");
                        for (var i in data.list) {
                            var list = data.list[i];
                            for (var j in list.cList) {
                                var cList = list.cList[j];
                                var startime = cList.startime;
                                for (var k in list.aList) {
                                    var aList = list.aList[k];
                                    var accountId=aList.accountId;
                                    var realName=aList.realName;
                                    var loginName = aList.loginName;
                                    var idcardNo=aList.idcardNo;
                                    var telephone=aList.telephone;
                                    var cD = aList.createDate;
                                    var createDate = getTime(cD);
                                    var lastLoginTime=aList.lastLoginTime;
                                    var lastStart=lastLoginTime-startime;
                                    var hours=gethTime(lastStart);
                                    var minutes=getmTime(lastStart);
                                }
                            }
                            $("#datalist").append("<tr><td>"+accountId+"</td><td>"+loginName+"</td><td>"+realName+"</td><td>"+idcardNo+"</td><td>"+telephone+"</td><td>"+createDate+"</td><td>"+hours+"小时"+minutes+"分"+"</td></tr>");
                        }
                        //            当前页码
                        var pageNum = data.pageNum;
//            每页的数量
                        var pageSize = data.pageSize;
//            当前页的数量
                        var size = data.size;
//            数据总数
                        var total = data.total;
//            一共多少页
                        var pages = data.pages;
//            首页是多少
                        var firstPage = data.firstPage;
//            上一页是多少
                        var prePage = data.prePage;
//            下一页是多少
                        var nextPage = data.nextPage;
//            最后一页是多少
                        var lastPage = data.lastPage;
//            是否是首页
                        var isFirstPage = data.isFirstPage;
//            是否是尾页
                        var isLastPage = data.isLastPage;
                        if (isFirstPage) {
                            prePage = prePage + 1;
                        }
                        if (isLastPage) {
                            nextPage = lastPage;
                        }
                        $("#pages").html("");
                        $("#pages").append($("<a href='javascript:void(0)' onclick='page(" + prePage + ")'>" + "<<<" + "</a>"));
                        for (i = 1; i <= lastPage; i++) {
                            $("#pages").append($("<a href='javascript:void(0)' onclick='page(" + i + ")'>" + i + "</a>"))
                        }
                        $("#pages").append($("<a href='javascript:void(0)' onclick='page(" + nextPage + ")'>" + ">>>" + "</a>"));
                        $("#pages a").siblings('a').removeClass('selected');
                        $("#pages a").eq(pageNum).addClass('current_page');
                    }
                });
            }
        }else if(num==2){
            var ip2 = 1;
            $.ajax({
                url: "/costPage",
                type: "post",
                data: {
                    pagenum: ip2
                },
                success: function (data) {
                    $("#datalist").html("");
                    $("#datalist").append("<tr><th class='width300'>Unix 服务器IP</th> <th>账务帐号</th><th>客户名称</th><th class='width200'>身份证号码</th><th class='width150'>累积时长</th></tr>");
                    for (var i in data.list) {
                        var list = data.list[i];
                        var unixHost=list.unixHost;
                        var lastStart = [];
                        for (var j in list.cList) {
                            var cList = list.cList[j];
                            var startime = cList.startime;
                            for (var k in list.aList) {
                                var aList = list.aList[k];
                                var realName=aList.realName;
                                var loginName = aList.loginName;
                                var idcardNo=aList.idcardNo;
                                var lastLoginTime=aList.lastLoginTime;
                                var lastStarts=lastLoginTime-startime;
                                lastStart.push(k.lastStarts);
                                var hours=gethTime(lastStarts);
                                var minutes=getmTime(lastStarts);
                            }
                        }
                        sortarr(lastStart);
                        function sortarr(lastStart) {
                            for (l = 0; l < lastStart.length - 1; l++) {
                                for (m = 0; m < lastStart.length - 1 - l; m++) {
                                    if (lastStart[m] > lastStart[m + 1]) {
                                        var temp = lastStart[m];
                                        lastStart[m] = lastStart[m + 1];
                                        lastStart[m + 1] = temp;
                                    }
                                }
                            }
                            return lastStart;
                        }
                        console.log(lastStart);
                        $("#datalist").append("<tr><td>"+unixHost+"</td><td>"+loginName+"</td><td>"+realName+"</td><td>"+idcardNo+"</td><td>"+hours+"小时"+minutes+"分"+"</td></tr>");
                    }
                    //            当前页码
                    var pageNum = data.pageNum;
//            每页的数量
                    var pageSize = data.pageSize;
//            当前页的数量
                    var size = data.size;
//            数据总数
                    var total = data.total;
//            一共多少页
                    var pages = data.pages;
//            首页是多少
                    var firstPage = data.firstPage;
//            上一页是多少
                    var prePage = data.prePage;
//            下一页是多少
                    var nextPage = data.nextPage;
//            最后一页是多少
                    var lastPage = data.lastPage;
//            是否是首页
                    var isFirstPage = data.isFirstPage;
//            是否是尾页
                    var isLastPage = data.isLastPage;
                    if (isFirstPage) {
                        prePage = prePage + 1;
                    }
                    if (isLastPage) {
                        nextPage = lastPage;
                    }
                    $("#pages").html("");
                    $("#pages").append($("<a href='javascript:void(0)' onclick='page(" + prePage + ")'>" + "<<<" + "</a>"));
                    for (i = 1; i <= lastPage; i++) {
                        $("#pages").append($("<a href='javascript:void(0)' onclick='page(" + i + ")'>" + i + "</a>"))
                    }
                    $("#pages").append($("<a href='javascript:void(0)' onclick='page(" + nextPage + ")'>" + ">>>" + "</a>"));
                    var urlstatus = false;
                    if (!urlstatus) {
                        $("#pages a").eq(1).addClass('current_page');
                    }
                }
            });
            function page(i) {
                ip2 = i;
                $.ajax({
                    url: "/costPage",
                    type: "post",
                    data: {
                        pagenum: ip2
                    },
                    success: function (data) {
                        $("#datalist").html("");
                        $("#datalist").append("<tr><th class='width300'>Unix 服务器IP</th> <th>账务帐号</th><th>客户名称</th><th class='width200'>身份证号码</th><th class='width150'>累积时长</th></tr>");
                        for (var i in data.list) {
                            var list = data.list[i];
                            var unixHost=list.unixHost;
                            for (var j in list.cList) {
                                var cList = list.cList[j];
                                var startime = cList.startime;
                                for (var k in list.aList) {
                                    var aList = list.aList[k];
                                    var realName=aList.realName;
                                    var loginName = aList.loginName;
                                    var idcardNo=aList.idcardNo;
                                    var lastLoginTime=aList.lastLoginTime;
                                    var lastStart=lastLoginTime-startime;
                                    var hours=gethTime(lastStart);
                                    var minutes=getmTime(lastStart);
                                }
                            }
                            $("#datalist").append("<tr><td>"+unixHost+"</td><td>"+loginName+"</td><td>"+realName+"</td><td>"+idcardNo+"</td><td>"+hours+"小时"+minutes+"分"+"</td></tr>");
                        }
                        //            当前页码
                        var pageNum = data.pageNum;
//            每页的数量
                        var pageSize = data.pageSize;
//            当前页的数量
                        var size = data.size;
//            数据总数
                        var total = data.total;
//            一共多少页
                        var pages = data.pages;
//            首页是多少
                        var firstPage = data.firstPage;
//            上一页是多少
                        var prePage = data.prePage;
//            下一页是多少
                        var nextPage = data.nextPage;
//            最后一页是多少
                        var lastPage = data.lastPage;
//            是否是首页
                        var isFirstPage = data.isFirstPage;
//            是否是尾页
                        var isLastPage = data.isLastPage;
                        if (isFirstPage) {
                            prePage = prePage + 1;
                        }
                        if (isLastPage) {
                            nextPage = lastPage;
                        }
                        $("#pages").html("");
                        $("#pages").append($("<a href='javascript:void(0)' onclick='page(" + prePage + ")'>" + "<<<" + "</a>"));
                        for (i = 1; i <= lastPage; i++) {
                            $("#pages").append($("<a href='javascript:void(0)' onclick='page(" + i + ")'>" + i + "</a>"))
                        }
                        $("#pages").append($("<a href='javascript:void(0)' onclick='page(" + nextPage + ")'>" + ">>>" + "</a>"));
                        $("#pages a").siblings('a').removeClass('selected');
                        $("#pages a").eq(pageNum).addClass('current_page');
                    }
                });
            }
        }else{
            var ip3 = 1;
            $.ajax({
                url: "/costPage",
                type: "post",
                data: {
                    pagenum: ip3
                },
                success: function (data) {
                    $("#datalist").html("");
                    $("#datalist").append("<tr><th class='width300'>Unix 服务器IP</th><th>包月</th><th>套餐</th><th>计时</th></tr>");
                    for (var i in data.list) {
                        var list = data.list[i];
                        var unixHost=list.unixHost;
                        for (var j in list.cList) {
                            var cList = list.cList[j];
                            var startime = cList.startime;
                            for (var k in list.aList) {
                                var aList = list.aList[k];
                                var realName=aList.realName;
                                var idcardNo=aList.idcardNo;
                                var telephone=aList.telephone;
                                var cD = aList.createDate;
                                var createDate = getTime(cD);
                                var lastLoginTime=aList.lastLoginTime;
                                var lastStart=lastLoginTime-startime;
                                var hours=gethTime(lastStart);
                                var minutes=getmTime(lastStart);
                                var seconds=getsTime(lastStart);
                            }
                        }
                        $("#datalist").append("<tr><td>"+unixHost+"</td><td>"+hours+"小时"+minutes+"分"+seconds+"秒</td><td>"+realName+"</td><td>"+idcardNo+"</td><td>"+telephone+"</td><td>"+createDate+"</td><td>"+hours+"小时"+minutes+"分"+"</td></tr>");
                    }
                    //            当前页码
                    var pageNum = data.pageNum;
//            每页的数量
                    var pageSize = data.pageSize;
//            当前页的数量
                    var size = data.size;
//            数据总数
                    var total = data.total;
//            一共多少页
                    var pages = data.pages;
//            首页是多少
                    var firstPage = data.firstPage;
//            上一页是多少
                    var prePage = data.prePage;
//            下一页是多少
                    var nextPage = data.nextPage;
//            最后一页是多少
                    var lastPage = data.lastPage;
//            是否是首页
                    var isFirstPage = data.isFirstPage;
//            是否是尾页
                    var isLastPage = data.isLastPage;
                    if (isFirstPage) {
                        prePage = prePage + 1;
                    }
                    if (isLastPage) {
                        nextPage = lastPage;
                    }
                    $("#pages").html("");
                    $("#pages").append($("<a href='javascript:void(0)' onclick='page(" + prePage + ")'>" + "<<<" + "</a>"));
                    for (i = 1; i <= lastPage; i++) {
                        $("#pages").append($("<a href='javascript:void(0)' onclick='page(" + i + ")'>" + i + "</a>"))
                    }
                    $("#pages").append($("<a href='javascript:void(0)' onclick='page(" + nextPage + ")'>" + ">>>" + "</a>"));
                    var urlstatus = false;
                    if (!urlstatus) {
                        $("#pages a").eq(1).addClass('current_page');
                    }
                }
            });
            function page(i) {
                ip3 = i;
                $.ajax({
                    url: "/costPage",
                    type: "post",
                    data: {
                        pagenum: ip3
                    },
                    success: function (data) {
                        $("#datalist").html("");
                        $("#datalist").append("<tr><th class='width300'>Unix 服务器IP</th><th>包月</th><th>套餐</th><th>计时</th></tr>");
                        for (var i in data.list) {
                            var list = data.list[i];
                            for (var j in list.cList) {
                                var cList = list.cList[j];
                                var startime = cList.startime;
                                for (var k in list.aList) {
                                    var aList = list.aList[k];
                                    var accountId=aList.accountId;
                                    var realName=aList.realName;
                                    var loginName = aList.loginName;
                                    var idcardNo=aList.idcardNo;
                                    var telephone=aList.telephone;
                                    var cD = aList.createDate;
                                    var createDate = getTime(cD);
                                    var lastLoginTime=aList.lastLoginTime;
                                    var lastStart=lastLoginTime-startime;
                                    var hours=gethTime(lastStart);
                                    var minutes=getmTime(lastStart);
                                }
                            }
                            $("#datalist").append("<tr><td>"+accountId+"</td><td>"+loginName+"</td><td>"+realName+"</td><td>"+idcardNo+"</td><td>"+telephone+"</td><td>"+createDate+"</td><td>"+hours+"小时"+minutes+"分"+"</td></tr>");
                        }
                        var pageNum = data.pageNum;

                        var pageSize = data.pageSize;
//            当前页的数量
                        var size = data.size;
//            数据总数
                        var total = data.total;
//            一共多少页
                        var pages = data.pages;
//            首页是多少
                        var firstPage = data.firstPage;
//            上一页是多少
                        var prePage = data.prePage;
//            下一页是多少
                        var nextPage = data.nextPage;
//            最后一页是多少
                        var lastPage = data.lastPage;
//            是否是首页
                        var isFirstPage = data.isFirstPage;
//            是否是尾页
                        var isLastPage = data.isLastPage;
                        if (isFirstPage) {
                            prePage = prePage + 1;
                        }
                        if (isLastPage) {
                            nextPage = lastPage;
                        }
                        $("#pages").html("");
                        $("#pages").append($("<a href='javascript:void(0)' onclick='page(" + prePage + ")'>" + "<<<" + "</a>"));
                        for (i = 1; i <= lastPage; i++) {
                            $("#pages").append($("<a href='javascript:void(0)' onclick='page(" + i + ")'>" + i + "</a>"))
                        }
                        $("#pages").append($("<a href='javascript:void(0)' onclick='page(" + nextPage + ")'>" + ">>>" + "</a>"));
                        $("#pages a").siblings('a').removeClass('selected');
                        $("#pages a").eq(pageNum).addClass('current_page');
                    }
                });
            }
        }
    }
</script>
</body>
</html>
